package com.woniuxy.hrp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.hrp.entity.ArrangeTime;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
@Mapper
public interface ArrangeTimeMapper extends BaseMapper<ArrangeTime> {
    @Select("select * from hrp_doctor_time hdt,hrp_arrangetime ha where ha.id=hdt.arrangetime_id and hdt.doctor_id=#{doctorid}")
    List<ArrangeTime> getByDoctorId(int doctorid);
    @Select("select * from hrp_arrangetime")
    List<ArrangeTime> getAllArrange();

    List<ArrangeTime> seleByAll();
    @Select("select * from hrp_arrangetime ha,hrp_doctor_time hd where hd.id = #{id} and hd.arrangetime_id=ha.id")

    ArrangeTime getbyid(int id);

    //根据id查询时间安排表
    @Select("select * from hrp_arrangetime where id=#{id}")
    ArrangeTime findById(int id);

    //新增时间表
    @Insert("insert into hrp_arrangetime values (null,#{date},#{startTime},#{fid},#{endTime})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    void myinsert(ArrangeTime arrangeTime);
}
